/**
 * 2017年11月25日
 */
package com.alibaba.study.concurrent;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Alex
 *
 */
@RequestMapping("/test")
public class X {

	List<String> arr = new ArrayList<String>();
	@RequestMapping("/a")
	public void method1(HttpServletRequest req, HttpServletResponse res) throws IOException {
		arr.add("a");
		arr.add("b");
		res.getWriter().println(arr.toString());
	}
	List<String> arr2 = new ArrayList<String>();
	@RequestMapping("/b")
	public synchronized void method2(HttpServletRequest req, HttpServletResponse res) throws IOException {
		arr2.add("a");
		arr2.add("b");
		res.getWriter().println(arr2.toString());
	}
	@RequestMapping("/c")
	public void method3(HttpServletRequest req, HttpServletResponse res) throws IOException {
		List<String> arr = new ArrayList<String>();
		arr.add("a");
		arr.add("b");
		res.getWriter().println(arr.toString());
	}

}
